<template>
	<view>
		<view class="banner">
			{{title}}
		</view>
		<view class="article-meta">
			<text class="article-meta-text article-author">发布时间：{{time}}</text>
		</view>
		<view class="article-content">

			<view class="parse-con">
				<u-parse :content="content"></u-parse>
			</view>

		</view>
		<view class="comment-wrap"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "",
				time: "",
				content: ""
			}
		},
		onLoad(option) {
			if (option.type) {
				if (option.type == "active") {
					this.get_active()
				}else{
					this.get_article()
				}
			}
			
			if(option.id){
				this.get_article_id(option.id)
			}
		},
		methods: {
			get_article_id(id){
				let that=this
				this.$model.get("user/common/get_article_id?id="+id).then(res=>{
					if(res.code==200){
						that.title=res.data.name
						that.time=res.data.created_at
						that.content=res.data.content
					}
				})
			},
			get_article(){
				let data = uni.getStorageSync("article")
				if (data) {
					this.title = data.name
					this.time = data.created_at
					this.content = data.content
					uni.removeStorageSync("article")
				}
			},
			get_active() {
				let data = uni.getStorageSync("active")
				if (data) {
					this.title = data.name
					this.time = data.created_at
					this.content = data.content
					uni.removeStorageSync("active")
				}
				console.log("aa",uni.getStorageSync("active"))
			}
		}
	}
</script>

<style>
 /* #ifndef APP-PLUS */
    page {
        min-height: 100%;
    }
 
    /* #endif */
    .baidu-arcontent {
        width: 98%;
 
    }
 
    .baidu-arcontent img,
    .baidu-arcontent image {
        max-width: 95% !important;
        mode: aspectFit;
    }
 
    .article-source {
        padding: 10upx;
        color: #AAAAAA;
    }
 
    .banner {
        margin: 10upx;
        text-align: center;
        font-size: 40upx;
        font-weight: bold;
 
    }
 
    .article-content image {
        width: 96%;
 
    }
 
 
    .banner-img {
        flex: 1;
    }
 
    .title-area {
        position: absolute;
        left: 30upx;
        right: 30upx;
        bottom: 30upx;
        z-index: 11;
    }
 
    .title-text {
        font-size: 32upx;
        font-weight: 400;
        line-height: 42upx;
        lines: 2;
        color: #ffffff;
        overflow: hidden;
    }
 
    .article-meta {
        padding: 20upx 30upx;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }
 
    .article-meta-text {
        color: gray;
    }
 
    .article-text {
        font-size: 26upx;
        line-height: 50upx;
        margin: 0 20upx;
    }
 
    .article-author {
        font-size: 30upx;
    }
 
    .article-time {
        font-size: 30upx;
    }
 
    .article-content {
        font-size: 30upx;
        padding: 0 30upx;
        margin-bottom: 30upx;
        overflow: hidden;
    }

</style>
